package com.qf.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 *
 * @author 阿亘
 * @date 2023/07/14
 */
@Mapper
@Repository
public interface UserAndBookDao {
    @Insert("insert into borrow (bookid, userid) values (#{bookid}, #{userid})")
    Integer borrowBook(@Param("bookid") Integer bookid, @Param("userid") Integer userid);

    @Delete("delete from borrow where bookid = #{bookid} and userid = #{userid}")
    Integer retuenBook(@Param("bookid") Integer bookid, @Param("userid") Integer userid);

    @Select("select id from borrow where bookid = #{bookid} and userid = #{userid}")
    Integer checkIfBorrow(@Param("bookid") Integer bookid, @Param("userid") Integer userid);
}
